<?php
namespace app\base\model;
use app\base\CommonModel;
class Collection extends CommonModel {
    public function getCollectList($user_id,$pageNo,$pageSize){
       $result['list']=$this->alias('c')
            ->join('yc_goods g','c.goods_id=g.goods_id','left')
            ->where(['c.user_id'=>$user_id,'g.goods_status'=>1,'g.is_delete'=>0])
            ->field('c.id,g.goods_id,g.goods_name,g.goods_price,g.goods_original_price,g.goods_thumb,g.goods_desc')
            ->page($pageNo,$pageSize)
            ->order('c.add_time','desc')
            ->select();

       $result['total']=$this->alias('c')
                           ->join('yc_goods g','c.goods_id=g.goods_id','left')
                           ->where(['c.user_id'=>$user_id,'g.goods_status'=>1,'g.is_delete'=>0])
                           ->field('c.id,g.goods_id,g.goods_name,g.goods_price,g.goods_original_price,g.goods_thumb,g.goods_desc')
                           ->order('c.add_time','desc')
                           ->count();
       return $result;
    }
}